import { createApp } from 'vue'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import 'default-passive-events' // fix: Passive Event Listeners
import './styles/index.scss'
import './style.css'
import App from './App.vue'
// import BaiduMap from 'vue-baidu-map-3x'
import router from './router'
// import router from './permission'; // 现router
import 'virtual:svg-icons-register'
import Vue from 'vue'
import i18n from '@/language'
let app = createApp(App);

import 'element-plus/es/components/message/style/css'
import 'element-plus/es/components/loading/style/css'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import auth from '@/utils/auth'
// router watch
import './permission'

// register all reactivity apis (`ref`, `computed`, `watch`, etc.)
import 'vue-global-api/reactivity'

import vue3videoPlay from "vue3-video-play" // 引入组件
import "vue3-video-play/dist/style.css" // 引入css

// store
import { createPinia } from 'pinia'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
const pinia = createPinia()

pinia.use(piniaPluginPersistedstate)

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 将 Vue I18n 实例作为全局属性挂载
app.config.globalProperties.$t = i18n.global.t
app.use(pinia)
  .use(router)
  .use(ElementPlus)
  .use(vue3videoPlay)
  .use(i18n)
  .directive('prmis', auth.initDirective())
  .mount('#app')
